feat: override links in directory cards - #1279
Conversation
auto-screenshot-update: true
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (29)
💤 Files with no reviewable changes (20)
🚧 Files skipped from review as they are similar to previous changes (9)
WalkthroughDirectory cards now support configurable link paths with optional slug normalization and visibility controls for address, hours, and phone sections. DirectoryWrapper exposes these as field mappings that resolve to card data while preserving existing card properties and slots. Entity field selectors now support locale-wide constant application and hidden requirements tooltips. A migration initializes link-override and contact-section display properties for existing cards and grids. Localized labels and guidance were added across 23 platform locales. Starter schema and test data now include an external directory child URL and Spanish pageset support. Sequence Diagram(s)sequenceDiagram
participant Editor
participant DirectoryWrapper
participant DirectoryCard
participant CardData
Editor->>DirectoryWrapper: configure link override and visibility fields
DirectoryWrapper->>CardData: normalize mapped values with defaults
DirectoryWrapper->>DirectoryCard: pass resolved card data and slots
DirectoryCard->>DirectoryCard: resolve override URL or entity URL
DirectoryCard->>DirectoryCard: apply slug normalization if enabled
DirectoryCard-->>DirectoryCard: render contact sections conditionally
DirectoryCard-->>Editor: display card with configured link and sections
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/visual-editor/src/components/directory/DirectoryCard.tsx (1)
273-332: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winResolve link overrides with the page/document locale and merged child document.
resolveComponentData(data.linkOverride, i18n.language, resolvedChild)can resolve the wrong language and can fall back to the link constant when the link is entity text embedded in a translatable object. UsestreamDocument.locale || "en"for entity resolution and pass the merged child document used by the card’s child-scoped resolution.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/visual-editor/src/components/directory/DirectoryCard.tsx` around lines 273 - 332, Update the link override resolution in the DirectoryCard component to use streamDocument.locale || "en" instead of i18n.language, and pass the merged child document from childDocumentContext rather than resolvedChild. Preserve the existing normalization and URL fallback behavior.
🧹 Nitpick comments (2)
packages/visual-editor/locales/platform/cs/visual-editor.json (1)
430-430: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winUse imperative Czech forms for action labels.
Change
Přepsat odkaztoPřepište odkazandZobrazit telefonní číslotoZobrazte telefonní číslo.Proposed translation update
- "overrideLink": "Přepsat odkaz", + "overrideLink": "Přepište odkaz", ... - "showPhoneNumber": "Zobrazit telefonní číslo", + "showPhoneNumber": "Zobrazte telefonní číslo",Based on learnings, Czech Visual Editor translations should prefer imperative verb forms, such as
Naplňte nádobu, instead of non-imperative forms.Also applies to: 495-495
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/visual-editor/locales/platform/cs/visual-editor.json` at line 430, Update the Czech Visual Editor translation values for overrideLink and the related “Zobrazit telefonní číslo” entry to use imperative forms: “Přepište odkaz” and “Zobrazte telefonní číslo”.Source: Learnings
starter/src/dev.config.ts (1)
9286-9297: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winFix "External Page Url" casing to match the "URL" convention used elsewhere.
The display name
"External Page Url"at Line 9296 and Line 11867 uses mixed casing for "Url". Every other URL-typed field display name in this file uses the fully capitalized form "URL", for example"Website URL","Menu URL","Order URL","Reservation URL","Android App URL", and"Landing Page URL". Change"External Page Url"to"External Page URL"in both places for consistency.✏️ Proposed fix
displayName: "External Page Url", + displayName: "External Page URL",- c_externalPageUrl: "External Page Url", + c_externalPageUrl: "External Page URL",Also applies to: 11867-11867
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@starter/src/dev.config.ts` around lines 9286 - 9297, Update the displayName for the c_externalPageUrl definitions to use “External Page URL” instead of “External Page Url” in both occurrences, including the definition near the second referenced location, while leaving their registry and type configuration unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/visual-editor/locales/platform/hr/visual-editor.json`:
- Line 430: Update the fields.overrideLink translation from cancel/ignore
wording to an accurate “Override Link” equivalent in all three affected files:
packages/visual-editor/locales/platform/hr/visual-editor.json lines 430-430
(Croatian), packages/visual-editor/locales/platform/lt/visual-editor.json lines
430-430 (Lithuanian), and
packages/visual-editor/locales/platform/lv/visual-editor.json lines 430-430
(Latvian).
In `@packages/visual-editor/locales/platform/ro/visual-editor.json`:
- Line 572: Correct the Romanian grammatical agreement in the
linkOverrideDirectoryTooltip translation by changing the feminine form referring
to URL-ul to the masculine form, using “va fi utilizat URL-ul directorului
generat” or the locale team’s approved equivalent.
- Line 430: Update the Romanian `overrideLink` translation to use the approved
override/replace wording for link paths, replacing the current “Ignore the link”
meaning while preserving the neighboring terminology for links.
In `@packages/visual-editor/src/components/directory/DirectoryWrapper.tsx`:
- Line 79: Update the directory template text flow so the value passed to pt()
is not pre-encoded by msg(), allowing the { entityType:
templateMetadata.entityTypeDisplayName } options at the call site to be applied
during interpolation. Adjust the related default-text definition and the pt()
call near the DirectoryWrapper render path while preserving the existing
displayed text and template metadata behavior.
---
Outside diff comments:
In `@packages/visual-editor/src/components/directory/DirectoryCard.tsx`:
- Around line 273-332: Update the link override resolution in the DirectoryCard
component to use streamDocument.locale || "en" instead of i18n.language, and
pass the merged child document from childDocumentContext rather than
resolvedChild. Preserve the existing normalization and URL fallback behavior.
---
Nitpick comments:
In `@packages/visual-editor/locales/platform/cs/visual-editor.json`:
- Line 430: Update the Czech Visual Editor translation values for overrideLink
and the related “Zobrazit telefonní číslo” entry to use imperative forms:
“Přepište odkaz” and “Zobrazte telefonní číslo”.
In `@starter/src/dev.config.ts`:
- Around line 9286-9297: Update the displayName for the c_externalPageUrl
definitions to use “External Page URL” instead of “External Page Url” in both
occurrences, including the definition near the second referenced location, while
leaving their registry and type configuration unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2a6a0176-4815-4782-aae9-14e055b9a664
📒 Files selected for processing (34)
packages/visual-editor/locales/platform/cs/visual-editor.jsonpackages/visual-editor/locales/platform/da/visual-editor.jsonpackages/visual-editor/locales/platform/de/visual-editor.jsonpackages/visual-editor/locales/platform/en-GB/visual-editor.jsonpackages/visual-editor/locales/platform/en/visual-editor.jsonpackages/visual-editor/locales/platform/es/visual-editor.jsonpackages/visual-editor/locales/platform/et/visual-editor.jsonpackages/visual-editor/locales/platform/fi/visual-editor.jsonpackages/visual-editor/locales/platform/fr/visual-editor.jsonpackages/visual-editor/locales/platform/hr/visual-editor.jsonpackages/visual-editor/locales/platform/hu/visual-editor.jsonpackages/visual-editor/locales/platform/it/visual-editor.jsonpackages/visual-editor/locales/platform/ja/visual-editor.jsonpackages/visual-editor/locales/platform/lt/visual-editor.jsonpackages/visual-editor/locales/platform/lv/visual-editor.jsonpackages/visual-editor/locales/platform/nb/visual-editor.jsonpackages/visual-editor/locales/platform/nl/visual-editor.jsonpackages/visual-editor/locales/platform/pl/visual-editor.jsonpackages/visual-editor/locales/platform/pt/visual-editor.jsonpackages/visual-editor/locales/platform/ro/visual-editor.jsonpackages/visual-editor/locales/platform/sk/visual-editor.jsonpackages/visual-editor/locales/platform/sv/visual-editor.jsonpackages/visual-editor/locales/platform/tr/visual-editor.jsonpackages/visual-editor/locales/platform/zh-TW/visual-editor.jsonpackages/visual-editor/locales/platform/zh/visual-editor.jsonpackages/visual-editor/src/components/directory/DirectoryCard.tsxpackages/visual-editor/src/components/directory/DirectoryWrapper.tsxpackages/visual-editor/src/components/migrations/0079_directory_card_display_props.tspackages/visual-editor/src/components/migrations/migrationRegistry.tspackages/visual-editor/src/editor/YextEntityFieldSelector.tsxpackages/visual-editor/src/fields/EntityFieldSelectorField.test.tsxpackages/visual-editor/src/fields/EntityFieldSelectorField.tsxstarter/localData/dev-dm-city-stream__en__8932945.jsonstarter/src/dev.config.ts
auto-screenshot-update: true
auto-screenshot-update: true
Adds a field to the directory grid to override links. When set to yes, an entity field selector is displayed. If a value is present for the selected entity field/constant value, then it will be used for the link. If there is no value, we will fallback to the standard url. Also adds a Normalize Link option when overriding.
This will be used to link certain locations in a directory to external pages. The directory config will be updated to include entities beyond the Yext Pages scope, and then those entities will have a field populated with their external url.
This PR also adds a field for testing, and wires a few props through the EntityFieldSelector that were inconsistently available.
Screen.Recording.2026-07-31.at.10.05.58.AM.mov